/**
 * 
 */
package org.mips.Sirius.components;

import java.util.ArrayList;

import com.google.android.maps.GeoPoint;

/**
 * @author Alessandro Represents a transport Line
 * 
 */
public class Line {

	private String reference;
	private String name;
	private ArrayList<StopPoint> stops = null;
	private ArrayList<GeoPoint> path = null;

	public String getReference() {
		return reference;
	}

	public void setReference(String reference) {
		this.reference = reference;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Line(String reference, String name) {
		this.reference = reference;
		this.name = name;
	}

	public Line(String reference) {
		this(reference, "noname");
	}

	@Override
	public String toString() {
		return name + " (" + reference + ")";
	}

	public void addStop(StopPoint stop) {
		if (this.stops == null) {
			this.stops = new ArrayList<StopPoint>();
		}
		this.stops.add(stop);
	}

	public ArrayList<GeoPoint> getPath() {
		return path;
	}

	public void addPathPoint(GeoPoint point) {
		if (this.path == null) {
			this.path = new ArrayList<GeoPoint>();
		}
		this.path.add(point);
	}

	public ArrayList<GeoPoint> getStopPointsPath() {
		ArrayList<GeoPoint> path = new ArrayList<GeoPoint>();
		if (this.stops == null)
			return path;
		for (StopPoint stop : this.stops) {
			path.add(stop.getCoordinates());
		}
		return path;
	}

}
